package com.woniuxy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.controller.info.ResponseInfo;
import com.woniuxy.model.Response;
import com.woniuxy.dao.ResponseDao;
import com.woniuxy.service.ResponseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.utils.CopyUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 马世亮
 * @since 2022-02-15
 */
@Service
public class ResponseServiceImpl extends ServiceImpl<ResponseDao, Response> implements ResponseService {

    @Override
    public List<ResponseInfo> getResponse(Integer defectid) {
        List<Response> responses = this.baseMapper.selectList(new QueryWrapper<Response>().eq("defect_id", defectid));
        List<ResponseInfo> responseInfos = CopyUtil.copyList(responses, ResponseInfo.class);

        return responseInfos;
    }
}
